
#define RUNTIME_DBG_LVL 0
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <dbg.h>
// #include <ddblk/syslock.h>
#include <ddblk/locks.h>
#include "dblk_test.h"

void test_spin(){
	SIMPLE_LOCKTEST(spin);
	SIMPLE_LOCKTEST_RELAX(spin);
	SIMPLE_LOCKTEST(bounded_spin);
	SIMPLE_LOCKTEST_RELAX(bounded_spin);
	SIMPLE_LOCKTEST(futex_spin);
	SIMPLE_LOCKTEST_RELAX(futex_spin);

	/* 测试失败的情况 */
	TIMEOUT_LOCKTEST(bounded_spin);
}

void test_ticket(){
	SIMPLE_LOCKTEST(ticket);
	SIMPLE_LOCKTEST_RELAX(ticket);
	SIMPLE_LOCKTEST(bounded_ticket);
	SIMPLE_LOCKTEST_RELAX(bounded_ticket);
	SIMPLE_LOCKTEST(futex_ticket);
	SIMPLE_LOCKTEST_RELAX(futex_ticket);

	/* 测试失败的情况 */
	TIMEOUT_LOCKTEST(bounded_ticket);
}
void test_syslock(){
	SYS_LOCKTEST(mutex);
	SYS_LOCKTEST(pspin);
}

int main(){
	test_spin();
	test_ticket();
	test_syslock();
	return 0;
}
